<?php /*a:2:{s:91:"C:\Users\37547\Desktop\china_and_russia\application\admin\view\mall_config\config_form.html";i:1560934322;s:79:"C:\Users\37547\Desktop\china_and_russia\application\admin\view\public\base.html";i:1560934322;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title><?php echo htmlentities($title); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/font.css" />
    <link rel="stylesheet" type="text/css" href="/static/admin/css/xadmin.css" />

    <script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/admin/lib/layui/layui.js"></script>
    <script type="text/javascript" src="/static/admin/js/global.js"></script>
    <script type="text/javascript" src="/static/admin/js/xadmin.js"></script>
    <script type="text/javascript" src="/static/common/js/common.js"></script>
    <script type="text/javascript" src="/static/admin/js/xcity.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="javascript:void(0);"><?php echo htmlentities($navigate[0]); ?></a>
        <a>
          <cite><?php echo htmlentities($navigate[1]); ?></cite>
        </a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href.split('?')[0]);" title="刷新">
        <i class="layui-icon" style="line-height:30px">&#xe669;</i></a>
</div>

<style>
    .layui-form-label {
        width: 120px;
    }

    .layui-form-item .layui-input-inline {
        width: 300px;
    }

    #demo1 {
        width: 200px;
    }

    #demoText {
        margin-top: 10px;
    }

    #test9 {
        display: none;
    }
</style>
    <div class="x-body">
        <form class="layui-form">
            <input type="hidden" name="type" value="<?php echo htmlentities($result['inc_type']); ?>" >
            <input type="hidden" name="id" value="<?php echo htmlentities($result['id']); ?>">

            <?php if($result['input_type'] == 0): ?>
            <div class="layui-form-item">
                <label for="value" class="layui-form-label">
                    <span class="x-red">*</span><?php echo htmlentities($result['name']); ?>
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="value" name="value" required="" lay-verify="required"
                           autocomplete="off" class="layui-input" value="<?php echo htmlentities($result['value']); ?>">
                </div>
                <?php if($result['desc'] != ''): ?>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span><?php echo htmlentities($result['desc']); ?>
                </div>
                <?php endif; ?>
            </div>
            <?php else: ?>
            <div class="layui-upload layui-form-item">
                <label for="value" class="layui-form-label">
                    <span class="x-red">*</span><?php echo htmlentities($result['name']); ?>
                </label>
                <button type="button" class="layui-btn layui-btn-normal" id="test8">选择文件</button>

                <div class="layui-upload-list">
                    <label class="layui-form-label"></label>
                    <img class="layui-upload-img" id="demo1" src="<?php if($result): ?><?php echo config('imgRoute'); ?><?php echo htmlentities($result['value']); ?><?php endif; ?>">
                    <p id="demoText"></p>
                </div>
                <label for="value" class="layui-form-label"></label>
                <button type="button" class="layui-btn" id="test9">开始上传</button>
            </div>
            <?php endif; if($result['input_type'] != 1): ?>
            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">
                </label>
                <button  class="layui-btn" lay-filter="edit" lay-submit="" id="L_repass">
                    修改
                </button>
            </div>
            <?php endif; ?>
        </form>
    </div>
    <script>
        formData('<?php echo url("MallConfig/config_form"); ?>', 'edit', function (){
            window.parent.location.reload();

            var index = parent.layer.getFrameIndex(window.name);
            //关闭当前frame
            parent.layer.close(index);
        }, false);

        $(function (){
            layui.use('upload', function() {
                var $ = layui.jquery, upload = layui.upload;
                var token = $("input[name='__token__']",top.window.document).val();

                upload.render({
                    elem: '#test8'
                    ,url: '<?php echo url("config_upload"); ?>'
                    ,data: {'__token__': token, 'id': '<?php echo htmlentities($result['id']); ?>', 'type': '<?php echo htmlentities($result['inc_type']); ?>'}
                    ,choose: function (obj) {
                        //预读本地文件示例，不支持ie8
                        obj.preview(function (index, file, result) {
                            $('#demo1').attr('src', result); //图片链接（base64）
                        });
                        $("#test9").css('display', 'block');
                    }
                    ,auto: false
                    ,accept: 'images'
                    ,field: 'img'
                    ,size: 2000
                    //,multiple: true
                    ,bindAction: '#test9'
                    ,done: function(res){
                        if(res.code == 1){
                            $("input[name='__token__']",top.window.document).val(res.data.token);
                            dialog(res.msg, res.url, 0, function (){
                                window.parent.location.reload();
                                var index = parent.layer.getFrameIndex(window.name);
                                //关闭当前frame
                                parent.layer.close(index);
                            }, false);
                        }else{
                            $("input[name='__token__']",top.window.document).val(res.data.token);
                            dialog(res.msg, false, 0, function (){
                                $("#test9").html('重新上传');
                            });

                        }
                    }
                    , error: function () {
                        //演示失败状态，并实现重传
                        dialog('网络似乎开了一下小差……', false, 0);
                        $("#test9").html('重新上传');
                    }
                });
            });
        })
    </script>


<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

    /*用户-停用*/
    function member_stop(obj,id,url){
        var title = $(obj).attr('title');
        var status = $(obj).data('status');

        layer.confirm('确认要'+ title +'吗？',function(index){
            var token = $("input[name='__token__']",top.window.document).val();
            $.post(url, {'status': status, '__token__': token, 'id': id}, function(res){
                if(res.code == 1){
                    var title = '停用',icon = '&#xe601;',text = '已启用',expr = 6;
                    if(res.data.status == 0){
                        title = '启用';
                        icon = '&#xe62f;';
                        text = '已停用';
                        expr = 5;

                        $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html(text);
                        $(obj).data('status', '1');
                    }else{
                        $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html(text);
                        $(obj).data('status', '0');
                    }
                }else{
                    text = res.msg;
                }

                $(obj).attr('title',title)
                $(obj).find('i').html(icon);

                layer.msg(text,{icon: expr,time:1000});

                var token = $("input[name='__token__']",top.window.document).val(res.data.token);
            }, 'json');
        });
    }

    /*用户-删除*/
    function member_del(obj,id, url, fn = false){
        layer.confirm('确认要删除吗？',function(index){
            var token = $("input[name='__token__']",top.window.document).val();
            //发异步删除数据
            $.post(url, {'id': id, '__token__': token},function(res){
                var icon = 2;
                if(res.code == 1){
                    $(obj).parents("tr").remove();
                    icon = 1;
                }
                $("input[name='__token__']",top.window.document).val(res.data.token);
                layer.msg(res.msg, {icon:icon,time:1000}, function(){
                    if(fn)fn();
                });

            },'json');
        });
    }

    function delAll (url) {
        var data = tableCheck.getData();
        var token = $("input[name='__token__']",top.window.document).val();

        layer.confirm('确认要删除吗？'+data,function(index){
            //捉到所有被选中的，发异步进行删除
            $.post(url, {'id': data, '__token__': token},function(res){
                var icon = 2;
                if(res.code == 1){
                    $(".layui-form-checked").not('.header').parents('tr').remove();
                    icon = 1;
                }
                $("input[name='__token__']",top.window.document).val(res.data.token);
                layer.msg(res.msg, {icon:icon,time:1000});
            },'json');
        });
    }

    // 跳转地址
    function load_url(url){
        window.location.href = url;
    }

</script>
<script>var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();</script>
</body>

</html>